//
//  MainTabBarViewController.m
//  大轮胎
//
//  Created by 朱永超 on 2017/3/16.
//  Copyright © 2017年 zyc. All rights reserved.
//

#import "MainTabBarViewController.h"
//引入头文件
#import "HomePageViewController.h"
#import "ChooseTireViewController.h"
#import "FoundViewController.h"
#import "MyViewController.h"
@interface MainTabBarViewController ()

@end

@implementation MainTabBarViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    //初始化视图控制器
    HomePageViewController *homeV = [[HomePageViewController alloc] init];
    ChooseTireViewController *chooseV = [[ChooseTireViewController alloc] init];
    FoundViewController *foundV = [[FoundViewController alloc] init];
    MyViewController *myV = [[MyViewController alloc] init];
    
        //添加导航
    UINavigationController *homeNav = [[UINavigationController alloc] initWithRootViewController:homeV];
    UINavigationController *chooseNav = [[UINavigationController alloc] initWithRootViewController:chooseV];
    UINavigationController *foundNav = [[UINavigationController alloc] initWithRootViewController:foundV];
    UINavigationController *myNav = [[UINavigationController alloc] initWithRootViewController:myV];
    //设置导航标题背景色
    homeNav.navigationBar.barTintColor = [UIColor orangeColor];
    chooseNav.navigationBar.barTintColor = [UIColor orangeColor];
    foundNav.navigationBar.barTintColor = [UIColor orangeColor];
    myNav.navigationBar.barTintColor = [UIColor orangeColor];
    //标签按钮
    UITabBarItem *homeItem = [[UITabBarItem alloc] initWithTitle:@"首页" image:[UIImage imageNamed:@"首页"]  selectedImage:nil];
      UITabBarItem *chooseItem = [[UITabBarItem alloc] initWithTitle:@"选胎" image:[UIImage imageNamed:@"轮胎"] selectedImage:nil];
    UITabBarItem *foundItem = [[UITabBarItem alloc] initWithTitle:@"发现" image:[UIImage imageNamed:@"发现"] selectedImage:nil];
    UITabBarItem *myItem = [[UITabBarItem alloc] initWithTitle:@"我的" image:[UIImage imageNamed:@"我的"] selectedImage:nil];
    //设置选中状态下的颜色
    self.tabBar.tintColor = [UIColor orangeColor];
    //设置标签控制器的颜色
    self.tabBar.barTintColor = [UIColor whiteColor];
    //添加按钮
    homeNav.tabBarItem = homeItem;
    chooseNav.tabBarItem = chooseItem;
    foundNav.tabBarItem = foundItem;
    myNav.tabBarItem = myItem;
    //添加到标签控制器 按顺序加入
    self.viewControllers = @[homeNav,chooseNav,foundNav,myNav];
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
